#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:装饰器参数.py
# author: 马国鑫
# datetime:2022/3/18 22:58
# software: PyCharm

"""
this is function  description 
"""


# import module your need

def logging(flag):
    def func_out(func):
        def func_in(a, b):
            # 传入flag参数主要增加一个功能就是判断是不是加法运算
            if flag == "+":
                print('正在进行加法运算')
                ret = func(a, b)
            else:
                print('不是加法运算')
            return ret

        return func_in

    return func_out


@logging('+')
# 1.调用logging('+')函数
# 2. @func_out
# 3.add = func_out(add)
def add(a, b):
    result = a + b
    return result


res = add(1, 2)
print(res)
